﻿using System;
using System.Collections.Generic;
using System.Text;
using Mate.Caching;
using Mate.Db.Model.Merchant;
using Mate.Db.SqlSugar;

namespace Mate.Merchant.Service
{
    public class MerchantTagService : DataService<mp_merchant_tag>, IMerchantTagService
    {
        private readonly ICacheManager _cache;
        public MerchantTagService(DataClient dataClient, ICacheManager cache) : base(dataClient)
        {
            this._cache = cache;
        }

        #region MyRegion
        /// <summary>
        /// 获取所有标签,返回KeyValuePair列表
        /// </summary>
        /// <returns></returns>
        public IList<KeyValuePair<string, string>> GetTagListKv()
        {
            IList<KeyValuePair<string, string>> MerchantTagList = new List<KeyValuePair<string, string>>();
            var tagList = GetList(x => x.is_open == 1);
            if (tagList != null)
            {
                foreach (var tag in tagList)
                {
                    MerchantTagList.Add(new KeyValuePair<string, string>(tag.tag_name, tag.tag_name));
                }
            }
            return MerchantTagList;
        }
        #endregion
    }
}
